package internal

import (
	"time"
)

type userResp struct {
	ID                uint64       `json:"id"`
	Platform          platformResp `json:"platform"`
	ThirdUserID       uint64       `json:"mch_user_id"`
	Nickname          string       `json:"nickname"`
	PortraitUri       string       `json:"portraitUri"`
	Level             int          `json:"level"`
	SuccessOrderCount int          `json:"success_order_count"`
	IsBlacklist       bool         `json:"is_blacklist"`
	Remark            string       `json:"remark"`
}

type verboseReq struct {
	Verbose bool `form:"verbose"`
}

type platformResp struct {
	ID   uint64 `json:"id"`
	Name string `json:"name"`
}

type uploadTokenResp struct {
	Key       string `json:"key"`
	Token     string `json:"token""`
	Thumbnail string `json:"thumbnail"`
}

type downloadTokenReq struct {
	Keys string `form:"keys"`
}

type downloadUrlsResp struct {
	Urls []downloadUrlResp `json:"urls"`
}

type downloadUrlResp struct {
	Key string `json:"key"`
	Url string `json:"url"`
}

type queryAgencyPayTypesReq struct {
	PlayerID uint64 `form:"player_id"`
	AgencyID uint64 `form:"agency_id"`
}

type sendReceiptReq struct {
	PlayerID uint64 `json:"player_id"`
	PayType  int    `json:"pay_type"`
}

// open api
// 通用post提交参数
type baseOpenReq struct {
	AppID     string `json:"app_id"`
	Timestamp int64  `json:"timestamp"`
	Sign      string `json:"sign"`
}

// 获取auth token
type authByOpenReq struct {
	baseOpenReq
	UserID      uint64 `json:"user_id"`
	Nickname    string `json:"nickname"`
	PortraitUri string `json:"portrait_uri"`
	LeavingTime uint64 `json:"im_leaving_time"`
}

type authByOpenResp struct {
	ID    uint64 `json:"id"`
	Token string `json:"token"`
}

// 更新用户信息
type updateUserInfoByOpenReq struct {
	baseOpenReq
	UserID      uint64 `json:"user_id"`
	Nickname    string `json:"nickname"`
	PortraitUri string `json:"portrait_uri"`
	Status      bool   `json:"status"`
	LeavingTime uint64 `json:"im_leaving_time"`
}

type updateUserInfoByOpenResp struct {
	ID uint64 `json:"id"`
}

// 获取用户信息
type getUserInfoOpenReq struct {
	baseOpenReq
	UserID uint64 `json:"user_id"`
}

type getUserInfoOpenResp struct {
	HasUnreadMsg bool `json:"has_unread_msg"`
}

// 黑名单
type blacklistReq struct {
	TargetID uint64 `json:"target_id"`
	Remark   string `json:"remark"`
}

// 备注
type RemarkReq struct {
	TargetID uint64 `json:"target_id"`
	Name     string `json:"name"`
}

// 举报
type ComplainReq struct {
	TargetID         uint64   `json:"target_id"`
	ComplaintContent string   `json:"complaint_content"`
	Images           []string `json:"images"`
	ComplaintTypes   uint64   `json:"complaint_types"`
}

// 会话列表查询
type listTopicsReq struct {
	AppID          string    `form:"app_id"`
	Timestamp      int64     `form:"timestamp"`
	Sign           string    `form:"sign"`
	ID             uint64    `form:"id"`
	AgencyIDS      string    `form:"agency_ids"`
	PlayMchID      uint64    `form:"play_mch_id"`
	PlayID         uint64    `form:"play_id"`
	StartUpdatedAt time.Time `form:"start_updated_at" time_format:"2006-01-02 15:04:05"`
	EndUpdatedAt   time.Time `form:"end_updated_at" time_format:"2006-01-02 15:04:05"`
	IsReplied      int       `form:"is_replied"`
	PageNo         int       `form:"page_no"`
	PageSize       int       `form:"page_size"`
}

type listTopicsResp struct {
	Total int         `json:"total"`
	List  []topicResp `json:"list"`
}

type topicResp struct {
	ID             uint64   `json:"id"`
	AgencyID       uint64   `json:"agency_id"`
	PlayMchID      uint64   `json:"player_mch_id"`
	PlayID         uint64   `json:"player_id"`
	CreateAt       AsiaTime `json:"created_at"`
	UpdatedAt      AsiaTime `json:"updated_at"`
	IsReplied      bool     `json:"is_replied"`
	UnreadMsgCount int      `json:"unread_msg_count"`
}

type messageResp struct {
	ID        uint64   `json:"id"`
	SourceID  uint64   `json:"source_id"`
	TargetID  uint64   `json:"target_id"`
	MsgType   int8     `json:"msg_type"`
	Info      string   `json:"info"`
	CreateAt  AsiaTime `json:"created_at"`
	UpdatedAt AsiaTime `json:"updated_at"`
}

// 单人会放详情查询
type listTopicMessagesReq struct {
	AppID     string `form:"app_id"`
	Timestamp int64  `form:"timestamp"`
	Sign      string `form:"sign"`
	LastMsgID uint64 `form:"last_msg_id"`
	PageSize  int    `form:"page_size"`
}

// 根据用户id查询聊天记录
type listMessagesReq struct {
	AppID     string `form:"app_id"`
	Timestamp int64  `form:"timestamp"`
	Sign      string `form:"sign"`
	AgencyID  uint64 `form:"agency_id"`
	PlayMchID uint64 `form:"play_mch_id"`
	PlayID    uint64 `form:"player_id"`
	LastMsgID uint64 `form:"last_msg_id"`
	PageSize  int    `form:"page_size"`
}

type listTopicMessagesResp struct {
	Agency userResp      `json:"agency"`
	Player userResp      `json:"player"`
	List   []messageResp `json:"list"`
}

// 支付成功订单推送
type notifyPayOrderReq struct {
	baseOpenReq
	OrderID    uint64 `json:"order_id"`
	PlayMchID  uint64 `json:"play_mch_id"`
	PlayID     uint64 `json:"player_id"`
	AgencyID   uint64 `json:"agency_id"`
	Amount     int64  `json:"amount"`
	RealAmount int64  `json:"real_amount"`
	Message    string `json:"message"`
}

// 投诉处理通知
type complainNotifyReq struct {
	baseOpenReq
	ComplainID uint64 `json:"complain_id"`
	PlayMchID  uint64 `json:"play_mch_id"`
	PlayID     uint64 `json:"player_id"`
	AgencyID   uint64 `json:"agency_id"`
	Message    string `json:"message"`
}

// 发送消息给代理
type SendMessageToAgencyReq struct {
	baseOpenReq
	AgencyID uint64 `json:"agency_id"`
	Message  string `json:"message"`
}
